﻿// DlgRecharge.cpp: 实现文件
//

#include "stdafx.h"
#include "GHCY.h"
#include "afxdialogex.h"
#include "DlgRecharge.h"


// DlgRecharge 对话框

IMPLEMENT_DYNAMIC(DlgRecharge, CDialogEx)

DlgRecharge::DlgRecharge(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_RECHARGE, pParent)
	, m_nRechargeValue(theApp.m_nRechargeValue)
	, m_fAgvChargeDelay(theApp.m_fAgvChargeDelay)
	, m_fChargeStationDelay(theApp.m_fChargeStationDelay)
	, m_nChargeWaitNewTask(theApp.m_nChargeWaitNewTask)
	, m_bBreakRecharge(theApp.m_bBreakRecharge)
{

}

DlgRecharge::~DlgRecharge()
{
}

void DlgRecharge::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, m_nRechargeValue);
	DDV_MinMaxInt(pDX, m_nRechargeValue, 0, 100);
	DDX_Text(pDX, IDC_EDIT2, m_fAgvChargeDelay);
	DDX_Text(pDX, IDC_EDIT3, m_fChargeStationDelay);
	DDX_Check(pDX, IDC_CHECK5, m_nChargeWaitNewTask);
	DDX_Check(pDX, IDC_CHECK14, m_bBreakRecharge);
}


BEGIN_MESSAGE_MAP(DlgRecharge, CDialogEx)
	ON_BN_CLICKED(IDOK, &DlgRecharge::OnBnClickedOk)
END_MESSAGE_MAP()


// DlgRecharge 消息处理程序

void DlgRecharge::OnBnClickedOk()
{
	UpdateData();

	theApp.m_nRechargeValue = m_nRechargeValue;
	theApp.setSysInt(L"m_nRechargeValue", (int&)m_nRechargeValue);
	theApp.m_fAgvChargeDelay = m_fAgvChargeDelay;
	theApp.setSysFloat(L"m_fAgvChargeDelay", m_fAgvChargeDelay);
	theApp.m_fChargeStationDelay = m_fChargeStationDelay;
	theApp.setSysFloat(L"m_fChargeStationDelay", m_fChargeStationDelay);
	theApp.m_nChargeWaitNewTask = m_nChargeWaitNewTask;
	theApp.setSysInt(L"m_nChargeWaitNewTask", (int&)m_nChargeWaitNewTask);

	theApp.m_bBreakRecharge = m_bBreakRecharge;
	theApp.setSysInt(L"m_bBreakRecharge", (int&)m_bBreakRecharge);

	CDialogEx::EndDialog(IDOK);
}
